package org.vison.wonfu.framework.soa.protocol;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.hc.client5.http.async.methods.SimpleHttpRequest;
import org.vison.wonfu.framework.soa.Invocation;

import java.io.IOException;
import java.lang.reflect.Type;
import java.net.URL;

public interface ParamsHandler {

    /**
     * pack invocation to SimpleHttpRequest
     */
    SimpleHttpRequest pack(Invocation invocation, ObjectMapper serialization)
            throws Exception;

    /**
     * unpack result
     */
    Object unpack(Object response,Invocation invocation,URL url) throws Exception;

    Object resolveBody(String responseBody, Type returnGenericType, ObjectMapper objectMapper) throws IOException;

}